import xlrd


def read_excel():
        #打开excel表
        workbook = xlrd.open_workbook("students.xlsx")
        #找到sheet1表
        table = workbook.sheet_by_name("Sheet1")
        #获取总行数总列数
        row_count = table.nrows
        col_count = table.ncols
        # 存放结果的数组，里面的元素是字典
        result =[]

        for r in range(1, row_count):
            student = {} #每行的数据代表一个学生的各个属性
            for c in range(0, col_count):
                key = table.cell_value(0, c)
                value = table.cell_value(r, c)
                student[key] = value
            result.append(student)
        return result



if __name__ == '__main__':
    print(read_excel())